import java.util.Scanner; // 需要导⼊ util 包
import java.util.Arrays;
public class Test {


    public static void main(String[] args) {


        public static void func(){
            //全拷贝（引用同一个数组）
            //改一个都会变
            int[] arr = {1,2,3,4,5,6};
            int[] newArr = arr;
            newArr[0] = 10;
            System.out.println("newArr: " + Arrays.toString(arr));

            //全拷贝（引用不同数组）
            //用Arrays中copyOf在拷贝的同时建一个新的数组
            //改一个另一个不变
            arr[0] = 1;
            newArr = Arrays.copyOf(arr, arr.length);
            System.out.println("newArr: " + Arrays.toString(newArr));

            //拷贝某个范围  [  ,  )
            int[] newArr2 = Arrays.copyOfRange(arr, 2, 4);
            System.out.println("newArr2: " + Arrays.toString(newArr2));
        }
    }

    public static void main6(String[] args) {

                add(1, 2);              // 调⽤add(int, int)
                add(1.5, 2.5);          // 调⽤add(double, double)
                add(1.5, 2.5, 3.5);     // 调⽤add(double, double, double)
            }

            public static int add(int x, int y) {
                return x + y;
            }

            public static double add(double x, double y) {
                return x + y;
            }

            public static double add(double x, double y, double z) {
                return x + y + z;

    }

    public static void main5(String[] args) {
        //检测⼀个年份是否为闰年
        public static boolean isLeapYear(int year){
            if((0 == year % 4 && 0 != year % 100) || 0 == year % 400){
                return true;
            }else{
                return false;
            }
        }


        //两个整数相加
        public static int add(int x, int y) {
            return x + y;
        }
    }

    public static void main4(String[] args) {


        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();//姓名
        int age = sc.nextInt();//年龄
        float salary = sc.nextFloat();//工资
        sc.close(); // 注意, 记得调⽤关闭⽅法



    }

    public static void main3(String[] args) {
        byte a = 10;
        byte b = 20;
        int c = a + b; // 编译出错
        System.out.println(c);
    }

    public static void main2(String[] args) {
        int a = 10;
        long b = 100L;
        b = a;        // int-->long，数据范围由⼩到⼤，隐式转换
        a = (int)b;   // long-->int, 数据范围由⼤到⼩，需要强转，否则编译失败

        float f = 3.14F;
        double d = 5.12;
        d = f;        // float-->double，数据范围由⼩到⼤，隐式转换
        f = (float)d; // double-->float, 数据范围由⼤到⼩，需要强转，否则编译失败


        byte b1 = 100;        // 100默认为int，没有超过byte范围，隐式转换
        byte b2 = (byte)257;  // 257默认为int，超过byte范围，需要显⽰转换，否则报错
    }

    int[] array1 = new int[]{0,1,2,3,4,5,6,7,8,9};
    public static void main1(String[] args) {
        int[] array = {1, 2, 3};
        for(int i = 0; i < array.length; ++i){
            System.out.println(array[i] + " ");
        }
    }
}
